<script lang="ts" setup>
import { reactive } from "vue";
import { IndexShowData } from "@/api/interface";
interface Props {
  data: IndexShowData;
}

defineProps<Props>();
</script>
<template>
  <!--内容-->

  <ul class="item-container">
    <li class="gallery-item current">
      <router-link :to="`/single/${data.id}`" class="tile">
        <div class="tile__media">
          <el-image :src="data.image.url" fit="cover"></el-image>
        </div>
        <div class="tile__gradient">
          <div class="tile__description">
            <div class="tile__head">
              <div class="tile__headline">
                {{ data.title }}
              </div>
            </div>
            <div class="tile__timestamp">{{ data.date }}</div>
          </div>
        </div>
      </router-link>
    </li>
  </ul>
</template>
<style lang="less" scoped>
//幻灯片

//内容

.item-container {
  display: flex;
  list-style: none;
  margin: 0;

  height: 100%;
}
//被选中了就高亮
.el-image {
  height: 100%;
}

.gallery-item {
  position: relative;
  margin-right: min(calc(1.87091vw + 3.51993 * (1vw - 10.69px)), 40px);
}
.current {
  .tile {
    opacity: 1;
  }
}

.tile {
  background-color: transparent;
  opacity: 0.6;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.25, 1) 0ms;

  display: block;
  position: relative;

  height: 100%;
  .tile__media {
    width: 980px;
    height: 551px;
  }
  .tile__gradient {
    position: absolute;
    bottom: 0;
    width: 100%;
    z-index: 0;
  }
  .tile__description {
    padding: 0 36px 36px;

    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
  }
  .tile__headline {
    font-size: 40px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0em;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }
  .tile__timestamp {
    margin-top: 12px;
  }

  .tile__gradient::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 250%;
    z-index: 0;
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.8),
      rgba(0, 0, 0, 0.77311) 12.83%,
      rgba(0, 0, 0, 0.72685) 24%,
      rgba(0, 0, 0, 0.66487) 33.77%,
      rgba(0, 0, 0, 0.59081) 42.37%,
      rgba(0, 0, 0, 0.50831) 50.07%,
      rgba(0, 0, 0, 0.421) 57.13%,
      rgba(0, 0, 0, 0.33252) 63.78%,
      rgba(0, 0, 0, 0.24652) 70.3%,
      rgba(0, 0, 0, 0.16663) 76.92%,
      rgba(0, 0, 0, 0.09648) 83.91%,
      rgba(0, 0, 0, 0.03973) 91.52%,
      rgba(0, 0, 0, 0)
    );
    background-size: 100.1% 100.1%;
  }
}

//颜色
.tile__headline,
.tile__category,
.tile__timestamp {
  color: #fff;
}
@media only screen and (max-width: 1068px) {
  .dotnav-items {
    margin-top: 1.88235rem;
  }
  .gallery-item {
    margin-right: calc(1.63265vw + 1.97095 * (1vw - 7.35px));
  }
  .tile {
    .tile__media {
      width: 692px;
      height: 389px;
    }
    .tile__description {
      padding: 0 24px 24px;
    }
    .tile__headline {
      font-size: 28px;
      line-height: 1.14286;
      font-weight: 700;
      letter-spacing: 0.007em;
    }
    .tile__timestamp {
      margin-top: 8px;
    }
  }
}
@media only screen and (max-width: 734px) {
  .gallery-item {
    flex: 1 0 100%;
    margin-right: 12px;
  }
  .tile {
    .tile__media {
      width: 100%;
      //padding-top: 125%;
      height: 100%;
      position: relative;
    }
    .tile__description {
      padding: 0 24px 24px;
    }
    .tile__headline {
      font-size: 24px;
      line-height: 1.16667;
      font-weight: 700;
      letter-spacing: 0.009em;
    }
    .tile__timestamp {
      margin-top: 8px;
    }
  }
}
</style>
